﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessObject;
using BusinessLayer;
namespace RestHouseReservation
{
    
    public partial class WebForm1 : System.Web.UI.Page
    {
        UsersLogic logic = new UsersLogic();
        public string result = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["PaNumber"] = "";
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            UserDao user = new UserDao();
            user.PaNumber = TextBox1.Text;
            user.Email = TextBox3.Text;
            user.Password = TextBox2.Text;
   
            result = logic.Login(user);
            if (result.Equals("1"))
            {
                Session["PaNumber"] = user.PaNumber;
                Server.Transfer("AdminPage.aspx");
            }
            else if (result.Equals("8"))
            {
                Session["PaNumber"] = user.PaNumber;
                Server.Transfer("UserPage.aspx");
            }
        }
    }
}